﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/content/table_btn.css")" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="@Url.Content("~/plugin/css/pikaday.css")">
<link rel="stylesheet" href="@Url.Content("~/plugin/css/site.css")">
<script src="@Url.Content("~/plugin/moment.min.js")"></script>
<script src="@Url.Content("~/plugin/pikaday.js")"></script>

<!--[if lt IE 8]>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
<![endif]-->

<noscript>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/content/activitie_noscript.css")" rel="stylesheet" type="text/css"/>
</noscript>

@model PessModel.ExpertJudge

@{
    ViewBag.Title = "Edit Reviewer";
}

<h2>Edit Reviewer</h2>
<div id="operate">
    
</div>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset class="edit">
        <legend>Enter information at first login
</legend>

        @*<div class="editor-label">
            Review Group
        </div>
        <div class="editor-field down">
            @{
                var expertGroupSelectionModel = (PessMvc.Models.ExpertGroupSelectionModel)ViewBag.ExpertGroupSelection;
                var expertGroups = expertGroupSelectionModel.ExpertGroups;
            }
           @if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin"))
            {
                for (int i = 0; i < expertGroups.Count(); i++)
                {
                    @Html.CheckBoxFor(m => expertGroups[i].IsSelected)
                    @expertGroups[i].LocalName
                    @Html.HiddenFor(m => expertGroups[i].Id)
                    @Html.HiddenFor(m => expertGroups[i].Name)
                }
            }
            else
            {
                if((bool)ViewBag.HideArchiveDetails==false)
                {
                    for(int i=0;i<expertGroups.Count;i++)
                    {
                        if(expertGroups[i].IsSelected)
                        {
                            @Html.Label(expertGroups[i].LocalName+",")
                        }
                    }
                }
            }
            
        </div>*@

        <div class="editor-label">
            Reviewer
        </div>
        <div class="editor-field down">
            @Html.DisplayFor(model => model.SerialNumber)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.Email)*@Email
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.Email)
            @Html.HiddenFor(model=>model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.RealName)*@Name
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RealName)
            @Html.ValidationMessageFor(model => model.RealName)
        </div>




        @*<div class="editor-label">
            @Html.LabelFor(model => model.UserID)用户ID：
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UserID)
            @Html.ValidationMessageFor(model => model.UserID)
        </div>*@

        <div class="editor-label">
            @*@Html.LabelFor(model => model.BirthDate)*@Affiliation
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.BirthDate)
            @Html.ValidationMessageFor(model => model.BirthDate)
        </div>

       <div class="editor-label">
            @*@Html.LabelFor(model => model.Phone)*@Phone
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Phone)
            @Html.ValidationMessageFor(model => model.Phone)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.ContactAddress)*@Address
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ContactAddress)
            @Html.ValidationMessageFor(model => model.ContactAddress)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.ZipCode)*@City
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.City)
            @Html.ValidationMessageFor(model => model.City)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.ZipCode)*@State
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.State)
            @Html.ValidationMessageFor(model => model.State)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.ZipCode)*@Country
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Country)
            @Html.ValidationMessageFor(model => model.Country)
        </div>

        <div class="editor-label">
            @*@Html.LabelFor(model => model.ZipCode)*@Zip Code
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ZipCode)
            @Html.ValidationMessageFor(model => model.ZipCode)
        </div>

       

        <div class="editor-btn">
            @Html.Hidden("ReturnUrl", (object)ViewBag.ReturnUrl)
            @Html.Hidden("UserID", Model.UserID)
            @Html.Hidden("ExpertGroupID", Model.ExpertGroupID)
            <input type="submit" value=" Save " />&#8195;
            @Html.ActionLink("Cancel", "Go2ReturnUrl", new { returnUrl = (object)ViewBag.ReturnUrl })
            @if(Roles.IsUserInRole("Admin"))
            {
           @Html.ActionLink("Reset Password", "ResetPassword", "Account", new
           {
               userName = Model.SerialNumber,
               returnUrl = HttpContext.Current.Request.RawUrl
           }, null)
            }
        </div>
    </fieldset>
}

<div id="dialog-message" title="Message">
    <p>
        <span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;">Message</span>
        <span id="msg_in_dialog"></span>
    </p>
</div>

<script type="text/javascript">
          $(document).ready(function () {

         $("#dialog-message").hide();

          $("form").submit(function (event) {
              event.preventDefault();
              $(this).validate().defaultShowErrors();
              if ($(this).valid()) {
                  // Show the "busy" Gif:
                  $('#msg_in_dialog').html("Processing...<br/><br/><img src='@Url.Content("~/images/ajax-loader.gif")'>");
                  $("#dialog-message").dialog({
                      modal: true
                  });

                  var url = $(this).attr("action");
                  var formData = $(this).serialize();
                  $.ajax({
                      url: url,
                      type: "POST",
                      data: formData,
                      dataType: "json",
                      success: function (url) {
                          // Hide the "busy" gif:
                          $('#msg_in_dialog').html("Changes saved.");
                          $("#dialog-message").dialog({
                              modal: true,
                              buttons: {
                                  "OK": function () {
                                      $("body").css("cursor", "progress");
                                      window.location.href = url;
                                      $(this).dialog("close");

                                  }
                              }
                          });
                          // Do something useful with the data:
                      }
                  })
              }
              else
              {
                  //$(".error").show();
                  //$('#msg_in_dialog').html("Please complete all the fields.");
                  //$("#dialog-message").dialog({
                  //    modal: true,
                  //    buttons: {
                  //        "Close": function () {
                  //            $(this).dialog("close");
                  //        }
                  //    }
                  //});
              }
          });

  });

</script>
